﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using AutoShutdownDotNet.DataAccess;

namespace AutoShutdownDotNet
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if(!File.Exists(Application.StartupPath + "\\" + Database.DatabaseFilename))
            {
                Database db =  new Database();
                try
                {
                    db.Create();
                }
                catch
                {
                    MessageBox.Show(db.LastError, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.Exit();
                }
            }

            Application.Run(new MainForm());
        }
    }
}
